package com.situ.orderingsystem.global;


import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebFilter("/*")
public class CharacterEncodingFilter implements Filter {
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        HttpServletResponse hp = (HttpServletResponse) servletResponse;
        HttpServletRequest hr = (HttpServletRequest) servletRequest;
        hp.setCharacterEncoding("utf-8");
        hr.setCharacterEncoding("utf-8");
        filterChain.doFilter(hr,hp);
    }
}
